exports.managerLogin = function (req, res) {

  var bodyParams = req.routeInfo.bodyParams;

  var resultData = {};

  //任务流创建
  async.waterfall([

     
      //查询是否已注册过该帐号
      function(cb){

          db.where({"a_username":bodyParams.username,"a_password":bodyParams.password}).select("dkp_admin",function(rs){

              if(rs == 'ERROR'){
                  return RES.errorResponse(res, false, "抱歉，用户登录失败");
              }

              if(rs.length <= 0){
                  return RES.errorResponse(res, false, "抱歉，帐号或密码不正确");
              }

              var userInfo = rs[0];

              //保存在SESSION中
              req.session.a_id      = userInfo.a_id;
              req.session.teamValue = bodyParams.teamValue;

              resultData.a_id   = userInfo.a_id;
              resultData.a_username = userInfo.a_username;

              cb();

          });

      }

  ], function (err, result) {

      //返回最终拼接结果
      RES.successResponse(res,resultData);

  });


}